# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-gversion
_rockname=gversion
_pkgname=gversion.lua
pkgver=0.2.0
pkgrel=3
pkgdesc="Lua library for Gentoo-style versioning format"
url="https://github.com/jirutka/gversion.lua"
arch="noarch"
license="MIT"
depends="lua"
source="$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	install -m 644 -D "$builddir"/src/gversion.lua \
		"$pkgdir"/usr/share/lua/common/gversion.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="1bae8b3d251cdb1ec6b6aab95214b3b456e2fa9b7b0d1c0f3dd7fb6ae1df170f74fb33386362699eb4cb375d4a885c2fb7513d6d084b79bb4947288d14d3643f  lua-gversion-0.2.0.tar.gz"
